package constants

import "jvmgo/ch09/instructions/base"
import "jvmgo/ch09/rtda"

//byte值入栈
type BIPUSH struct {
    val int8
}

func (self *BIPUSH) FetchOperands(reader *base.BytecodeReader) {
    self.val = reader.ReadInt8()
}
func (self *BIPUSH) Execute(frame *rtda.Frame) {
    i := int32(self.val)
    frame.OperandStack().PushInt(i)
}

//short值入栈
type SIPUSH struct {
    val int16
}

func (self *SIPUSH) FetchOperands(reader *base.BytecodeReader) {
    self.val = reader.ReadInt16()
}
func (self *SIPUSH) Execute(frame *rtda.Frame) {
    i := int32(self.val)
    frame.OperandStack().PushInt(i)
}